//
//  CurrencyConverterHead.m
//  ZITHER
//
//  Created by weixin on 2019/1/9.
//  Copyright © 2019 weixn. All rights reserved.
//

#import "CurrencyConverterHead.h"

@implementation CurrencyConverterHead

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor colorWithHex:@"f5f5f5"];
        [self setUI];
        [self setMassonry];
    }
    return self;
}

-(void)setModel:(skuDetailModel *)model{
    _model = model;
    self.bandLab.text = model.goodNameNative;
    self.serieslab.text = [NSString stringWithFormat:@"%@%@",model.brandNameNative,model.seriesName];
    
}

-(void)setUI{
    [self addSubview:self.bandLab];
    [self addSubview:self.serieslab];
    [self addSubview:self.officiallab];
    [self addSubview:self.refreshbtn];
    [self addSubview:self.refreshIconbtn];
}

-(void)setMassonry{
    [self.bandLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(15);
        make.top.equalTo(self).offset(18);
        make.height.mas_equalTo(18);
    }];
    [self.serieslab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(15);
        make.top.equalTo(self.bandLab.mas_bottom).offset(5);
        make.height.mas_equalTo(15);
    }];
    [self.officiallab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(15);
        make.top.equalTo(self.serieslab.mas_bottom).offset(15);
        make.height.mas_equalTo(15);
    }];
    [self.refreshbtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.refreshIconbtn.mas_left).offset(-5);
        make.centerY.equalTo(self.officiallab.mas_centerY).offset(0);
        make.height.mas_equalTo(20);
    }];
//    self.refreshIconbtn.backgroundColor = [UIColor greenColor];
    [self.refreshIconbtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).offset(-15);
        make.centerY.equalTo(self.officiallab.mas_centerY).offset(0);
        make.height.width.mas_equalTo(15);
    }];
}

-(BaseLab *)bandLab{
    if (!_bandLab) {
        _bandLab = [[BaseLab alloc]initializeFrame:CGRectMake(0, 0, 0, 0) text:@"30003/000P-82000型号" font:0 textColor:[UIColor colorWithHex:@"000000"] isBold:0 numberOfLines:1];
        _bandLab.font = [UIFont fontWithName:@"Arial-BoldMT" size:15];

    }
    return _bandLab;
}

-(BaseLab *)serieslab{
    if (!_serieslab) {
        _serieslab = [[BaseLab alloc]initializeFrame:CGRectMake(0, 0, 0, 0) text:@"劳力士潜航者系列" font:0 textColor:[UIColor colorWithHex:@"000000"] isBold:0 numberOfLines:1];
        _serieslab.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:12];
    }
    return _serieslab;
}


-(BaseLab *)officiallab{
    if (!_officiallab) {
        _officiallab = [[BaseLab alloc]initializeFrame:CGRectMake(0, 0, 0, 0) text:@"公价" font:0 textColor:[UIColor colorWithHex:@"333333"] isBold:0 numberOfLines:1];
        _officiallab.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:15];
    }
    return _officiallab;
}


-(BaseBtn *)refreshbtn{
    if (!_refreshbtn) {
        _refreshbtn = [[BaseBtn alloc]initializeFrame:CGRectMake(0, 0, 0, 0) NormalText:@"换算" NormalTextColor:baseColorTheme SeleText:@"还原" SeleTextColor:baseColorTheme font:0 isBold:0];
        _refreshbtn.backgroundColor = [UIColor clearColor];
        _refreshbtn.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:15];
      
    }
    return _refreshbtn;
}

-(BaseBtn *)refreshIconbtn{
    if (!_refreshIconbtn) {
        _refreshIconbtn = [[BaseBtn alloc]initializeFrame:CGRectMake(0, 0, 0, 0) NormalImage:@"sku_换算" SeleImage:@"sku_还原"];
        _refreshIconbtn.backgroundColor = [UIColor clearColor];
     
        
    }
    return _refreshIconbtn;
}


@end
